// 代理服务器
const express = require('express')
const cors = require('cors')
const { createProxyMiddleware: proxy } = require('http-proxy-middleware')
const app = express()
app.listen(4000)

app.use('/api', proxy({
  target: 'https://www.baidu.com',
  changeOrigin: true,
  pathRewrite: {
    '^/api': ''
  }
}))

